﻿<%@page import="com.bdqn.newdream.pojo.Dreamuser"%>
<%@page import="com.bdqn.newdream.javabean.*"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<meta charset="utf-8">
<meta name="author" content="order by dede58.com/" />
<title>发表问题</title>
 <!-- 背景 -->
    <script type="text/javascript" defer="" async="" src="file/js/Template.js"></script>
	<script type="text/javascript" defer="" async="" src="file/js/Special_effect.js"></script>
	<link rel="stylesheet" href="file/css/Template.css">
    <!-- -- -->
<meta name="viewport"
	content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="keywords" content="fly,layui,前端社区">
<meta name="description" content="">
<link rel="stylesheet" href="file/res/layui/css/layui.css">
<link rel="stylesheet" href="file/res/css/global.css">
<script src="file/js/jquery-1.7.2.min.js">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

<script src="file/res/layui/layui.js"></script>
 <style type="text/css">
    .toolbar {
      border: 1px solid #ccc;
    }
    .text {
      border: 1px solid #ccc;
      height: 400px;
    }
  </style>

<script>"undefined"==typeof CODE_LIVE&&(!function(e){var t={nonSecure:"56517",secure:"56522"},c={nonSecure:"http://",secure:"https://"},r={nonSecure:"127.0.0.1",secure:"gapdebug.local.genuitec.com"},n="https:"===window.location.protocol?"secure":"nonSecure";script=e.createElement("script"),script.type="text/javascript",script.async=!0,script.src=c[n]+r[n]+":"+t[n]+"/codelive-assets/bundle.js",e.getElementsByTagName("head")[0].appendChild(script)}(document),CODE_LIVE=!0);</script></head>
<body style="overflow-y: overlay;" data-genuitec-lp-enabled="false" data-genuitec-file-id="wc1-19" data-genuitec-path="/dreaming/WebRoot/WEB-INF/jsp/add.jsp">
	<canvas id="sakura" width="1" height="1" data-genuitec-lp-enabled="false" data-genuitec-file-id="wc1-19" data-genuitec-path="/dreaming/WebRoot/WEB-INF/jsp/add.jsp"></canvas>
	<div class="btnbg">
	<div class="header">
		<div class="main">
			<a class="title" href="main" title="新梦想">新梦想</a>
			<div class="nav">
				<a class="nav-this" href="main"> <i
					class="iconfont icon-wenda"></i>你问我答
				</a>
			</div>
			<div class="nav-user">
				<!-- 登入后的状态 -->
				<a class="avatar" href="<%=((DreamingUser) session.getAttribute("user"))==null?"login":"message/"+((DreamingUser)session.getAttribute("user")).getMessage().getId()%>">
				<img src="<%=((DreamingUser)session.getAttribute("user"))==null?request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+"/userimg/u=2269676958,3475806430&fm=214&gp=0.jpg":((DreamingUser)session.getAttribute("user")).getMessage().getImg()%>">
						<cite href=""><%=((DreamingUser)session.getAttribute("user"))==null?"<a href='login'>请登录</a>":((DreamingUser)session.getAttribute("user")).getMessage().getNickname()%></cite>
				</a>
				<div class="nav">
					<c:if test="${not empty user}">
			 			<a href="quit"><i class="iconfont icon-tuichu"
						style="top: 0; font-size: 22px;"></i>注销</a>
			 		</c:if>
				</div>
			</div>
		</div>
	</div>

	<div class="main layui-clear">
		<div class="fly-panel" pad20>
			<h2 class="page-title">发表问题</h2>

			<!-- <div class="fly-none">并无权限</div> -->

			<div class="layui-form layui-form-pane">
				<form action="savep" method="post" enctype="multipart/from-data"
					accept-charset="utf-8">
					<input type="hidden" name="content" id="content" value="fsdafd">
					<div class="layui-form-item" style="width: 100%;">
						<label for="L_title" class="layui-form-label">标题</label>
						<div class="layui-input-block">
							<input type="text" id="L_title" name="title" required
								lay-verify="required" autocomplete="off" class="layui-input">
						</div>
					</div>
					<div class="layui-form-item layui-form-text" style="width: 100%;">
						<div class="layui-input-block">
						
			<div id="div1" class="toolbar">
            </div>
            <div style="padding: 5px 0; color: #ccc"><br/></div>
            <div id="div2" class="text" style="min-height:500px" name="temp"> <!--可使用 min-height 实现编辑区域自动增加高度-->
              <p></p>
            </div>
			
            <script type="text/javascript" src="file/editor/wangEditor.js"></script>
            <script type="text/javascript">
                var E = window.wangEditor
                var editor1 = new E('#div1', '#div2')  // 两个参数也可以传入 elem 对象，class 选择器
                editor1.customConfig.uploadImgServer = 'saveimg'  // 上传图片到服务器
                editor1.customConfig.uploadImgMaxLength = 5
                editor1.customConfig.uploadImgMaxSize = 4 * 1024 * 1024
                editor1.customConfig.uploadFileName = 'file'
                editor1.create()
            </script>
						</div>
						<label for="L_content" class="layui-form-label" style="top: -2px;">描述</label>
					</div>
					<div class="layui-form-item">
						<button class="layui-btn" id="button1">立即发布</button>
					</div>
				</form>
			</div>
		</div>
	</div>
	</div>
	


</body>
</html>
<script type="text/javascript">
$(document).ready(function (){
	$("#button1").click(function () {
		if($("#L_title").val()!=null&&$("#L_title").val()!=""){
			$("#content").val(editor1.txt.html());
			$("#button1").submit()
		}else{
			alert("请输入标题!");
		}
    })
})
</script>
	<script id="sakura_point_vsh" type="x-shader/x_vertex">
uniform mat4 uProjection;
uniform mat4 uModelview;
uniform vec3 uResolution;
uniform vec3 uOffset;
uniform vec3 uDOF; 
uniform vec3 uFade;
attribute vec3 aPosition;
attribute vec3 aEuler;
attribute vec2 aMisc;
varying vec3 pposition;
varying float psize;
varying float palpha;
varying float pdist;
varying vec3 normX;
varying vec3 normY;
varying vec3 normZ;
varying vec3 normal;
varying float diffuse;
varying float specular;
varying float rstop;
varying float distancefade;
void main(void) {

    // Projection is based on vertical angle

    vec4 pos = uModelview * vec4(aPosition + uOffset, 1.0);

    gl_Position = uProjection * pos;

    gl_PointSize = aMisc.x * uProjection[1][1] / -pos.z * uResolution.y * 0.5;

    

    pposition = pos.xyz;

    psize = aMisc.x;

    pdist = length(pos.xyz);

    palpha = smoothstep(0.0, 1.0, (pdist - 0.1) / uFade.z);

    

    vec3 elrsn = sin(aEuler);

    vec3 elrcs = cos(aEuler);

    mat3 rotx = mat3(

        1.0, 0.0, 0.0,

        0.0, elrcs.x, elrsn.x,

        0.0, -elrsn.x, elrcs.x

    );

    mat3 roty = mat3(

        elrcs.y, 0.0, -elrsn.y,

        0.0, 1.0, 0.0,

        elrsn.y, 0.0, elrcs.y

    );

    mat3 rotz = mat3(

        elrcs.z, elrsn.z, 0.0, 

        -elrsn.z, elrcs.z, 0.0,

        0.0, 0.0, 1.0

    );

    mat3 rotmat = rotx * roty * rotz;

    normal = rotmat[2];

    

    mat3 trrotm = mat3(

        rotmat[0][0], rotmat[1][0], rotmat[2][0],

        rotmat[0][1], rotmat[1][1], rotmat[2][1],

        rotmat[0][2], rotmat[1][2], rotmat[2][2]

    );

    normX = trrotm[0];

    normY = trrotm[1];

    normZ = trrotm[2];

    

    const vec3 lit = vec3(0.6917144638660746, 0.6917144638660746, -0.20751433915982237);

    

    float tmpdfs = dot(lit, normal);

    if(tmpdfs < 0.0) {

        normal = -normal;

        tmpdfs = dot(lit, normal);

    }

    diffuse = 0.4 + tmpdfs;

    

    vec3 eyev = normalize(-pos.xyz);

    if(dot(eyev, normal) > 0.0) {

        vec3 hv = normalize(eyev + lit);

        specular = pow(max(dot(hv, normal), 0.0), 20.0);

    }

    else {

        specular = 0.0;

    }

    

    rstop = clamp((abs(pdist - uDOF.x) - uDOF.y) / uDOF.z, 0.0, 1.0);

    rstop = pow(rstop, 0.5);

    //-0.69315 = ln(0.5)

    distancefade = min(1.0, exp((uFade.x - pdist) * 0.69315 / uFade.y));

}

</script>

	<script id="sakura_point_fsh" type="x-shader/x_fragment">

#ifdef GL_ES

//precision mediump float;

precision highp float;

#endif



uniform vec3 uDOF;  //x:focus distance, y:focus radius, z:max radius

uniform vec3 uFade; //x:start distance, y:half distance, z:near fade start



const vec3 fadeCol = vec3(0.08, 0.03, 0.06);



varying vec3 pposition;

varying float psize;

varying float palpha;

varying float pdist;



//varying mat3 rotMat;

varying vec3 normX;

varying vec3 normY;

varying vec3 normZ;

varying vec3 normal;



varying float diffuse;

varying float specular;

varying float rstop;

varying float distancefade;



float ellipse(vec2 p, vec2 o, vec2 r) {

    vec2 lp = (p - o) / r;

    return length(lp) - 1.0;

}



void main(void) {

    vec3 p = vec3(gl_PointCoord - vec2(0.5, 0.5), 0.0) * 2.0;

    vec3 d = vec3(0.0, 0.0, -1.0);

    float nd = normZ.z; //dot(-normZ, d);

    if(abs(nd) < 0.0001) discard;

    

    float np = dot(normZ, p);

    vec3 tp = p + d * np / nd;

    vec2 coord = vec2(dot(normX, tp), dot(normY, tp));

    

    //angle = 15 degree

    const float flwrsn = 0.258819045102521;

    const float flwrcs = 0.965925826289068;

    mat2 flwrm = mat2(flwrcs, -flwrsn, flwrsn, flwrcs);

    vec2 flwrp = vec2(abs(coord.x), coord.y) * flwrm;

    

    float r;

    if(flwrp.x < 0.0) {

        r = ellipse(flwrp, vec2(0.065, 0.024) * 0.5, vec2(0.36, 0.96) * 0.5);

    }

    else {

        r = ellipse(flwrp, vec2(0.065, 0.024) * 0.5, vec2(0.58, 0.96) * 0.5);

    }

    

    if(r > rstop) discard;

    

    vec3 col = mix(vec3(1.0, 0.8, 0.75), vec3(1.0, 0.9, 0.87), r);

    float grady = mix(0.0, 1.0, pow(coord.y * 0.5 + 0.5, 0.35));

    col *= vec3(1.0, grady, grady);

    col *= mix(0.8, 1.0, pow(abs(coord.x), 0.3));

    col = col * diffuse + specular;

    

    col = mix(fadeCol, col, distancefade);

    

    float alpha = (rstop > 0.001)? (0.5 - r / (rstop * 2.0)) : 1.0;

    alpha = smoothstep(0.0, 1.0, alpha) * palpha;

    

    gl_FragColor = vec4(col * 0.5, alpha);

}

</script>

	<!-- effects -->

	<script id="fx_common_vsh" type="x-shader/x_vertex">

uniform vec3 uResolution;

attribute vec2 aPosition;



varying vec2 texCoord;

varying vec2 screenCoord;



void main(void) {

    gl_Position = vec4(aPosition, 0.0, 1.0);

    texCoord = aPosition.xy * 0.5 + vec2(0.5, 0.5);

    screenCoord = aPosition.xy * vec2(uResolution.z, 1.0);

}

</script>

	<script id="bg_fsh" type="x-shader/x_fragment">

#ifdef GL_ES

//precision mediump float;

precision highp float;

#endif



uniform vec2 uTimes;



varying vec2 texCoord;

varying vec2 screenCoord;



void main(void) {

    vec3 col;

    float c;

    vec2 tmpv = texCoord * vec2(0.8, 1.0) - vec2(0.95, 1.0);

    c = exp(-pow(length(tmpv) * 1.8, 2.0));

    col = mix(vec3(0.02, 0.0, 0.03), vec3(0.96, 0.98, 1.0) * 1.5, c);

    gl_FragColor = vec4(col * 0.5, 1.0);

}

</script>

	<script id="fx_brightbuf_fsh" type="x-shader/x_fragment">

#ifdef GL_ES

//precision mediump float;

precision highp float;

#endif

uniform sampler2D uSrc;

uniform vec2 uDelta;



varying vec2 texCoord;

varying vec2 screenCoord;



void main(void) {

    vec4 col = texture2D(uSrc, texCoord);

    gl_FragColor = vec4(col.rgb * 2.0 - vec3(0.5), 1.0);

}

</script>

	<script id="fx_dirblur_r4_fsh" type="x-shader/x_fragment">

#ifdef GL_ES

//precision mediump float;

precision highp float;

#endif

uniform sampler2D uSrc;

uniform vec2 uDelta;

uniform vec4 uBlurDir; //dir(x, y), stride(z, w)



varying vec2 texCoord;

varying vec2 screenCoord;



void main(void) {

    vec4 col = texture2D(uSrc, texCoord);

    col = col + texture2D(uSrc, texCoord + uBlurDir.xy * uDelta);

    col = col + texture2D(uSrc, texCoord - uBlurDir.xy * uDelta);

    col = col + texture2D(uSrc, texCoord + (uBlurDir.xy + uBlurDir.zw) * uDelta);

    col = col + texture2D(uSrc, texCoord - (uBlurDir.xy + uBlurDir.zw) * uDelta);

    gl_FragColor = col / 5.0;

}

</script>

	<!-- effect fragment shader template -->

	<script id="fx_common_fsh" type="x-shader/x_fragment">

#ifdef GL_ES

//precision mediump float;

precision highp float;

#endif

uniform sampler2D uSrc;

uniform vec2 uDelta;



varying vec2 texCoord;

varying vec2 screenCoord;



void main(void) {

    gl_FragColor = texture2D(uSrc, texCoord);

}

</script>

	<!-- post processing -->

	<script id="pp_final_vsh" type="x-shader/x_vertex">

uniform vec3 uResolution;

attribute vec2 aPosition;

varying vec2 texCoord;

varying vec2 screenCoord;

void main(void) {

    gl_Position = vec4(aPosition, 0.0, 1.0);

    texCoord = aPosition.xy * 0.5 + vec2(0.5, 0.5);

    screenCoord = aPosition.xy * vec2(uResolution.z, 1.0);

}

</script>

	<script id="pp_final_fsh" type="x-shader/x_fragment">

#ifdef GL_ES

//precision mediump float;

precision highp float;

#endif

uniform sampler2D uSrc;

uniform sampler2D uBloom;

uniform vec2 uDelta;

varying vec2 texCoord;

varying vec2 screenCoord;

void main(void) {

    vec4 srccol = texture2D(uSrc, texCoord) * 2.0;

    vec4 bloomcol = texture2D(uBloom, texCoord);

    vec4 col;

    col = srccol + bloomcol * (vec4(1.0) + srccol);

    col *= smoothstep(1.0, 0.0, pow(length((texCoord - vec2(0.5)) * 2.0), 1.2) * 0.5);

    col = pow(col, vec4(0.45454545454545)); //(1.0 / 2.2)

    

    gl_FragColor = vec4(col.rgb, 1.0);

    gl_FragColor.a = 1.0;

}

</script>
